//
//  GQHInvoiceModel.m
//  Xanthium
//
//  Created by GuanQinghao on 15/05/2018.
//  Copyright © 2018 GuanQinghao. All rights reserved.
//

#import "GQHInvoiceModel.h"
#import "GQHHeader.h"

@implementation GQHInvoiceModel

+ (nullable NSDictionary<NSString *, id> *)modelCustomPropertyMapper {
    
    
    
    return @{
             
             @"qh_purchaserName" : @"purchaserName",
             @"qh_taxpayerNumber" : @"taxpayerIdNum",
             @"qh_address" : @"address",
             @"qh_mobile" : @"phoneNum",
             @"qh_account" : @"openAccountNum",
             @"qh_bank" : @"openAccountBank",
             @"qh_taxableServiceName" : @"laborName",
             @"qh_totalAmount" : @"totalAmount",
             @"qh_note" : @"note",
             @"qh_unit" : @"unit",
             @"qh_quantity" : @"demandVehicle",
             @"qh_specifications" : @"specifications"
             };
}

/// 查看发票
+ (void)qh_requestInvoiceWithParameters:(NSMutableDictionary *)parameters success:(void(^)(BOOL status, NSNumber *code, NSString *message, GQHInvoiceModel *invoice))success failure:(void(^)(NSError *error))failure {
    
    NSString *APIURLString = [[NSString qh_APIURLString] stringByAppendingPathComponent:@"/buInvoice/1/list"];
    
    [GQHNetHelper qh_requestGET:APIURLString parameters:parameters success:^(NSNumber *code, NSString *message, NSDictionary *data) {
        DLog(@"%@---%@---%@",code,message,data);
        
        if (0 == [code integerValue]) {
            
            GQHInvoiceModel *invoiceModel = [GQHInvoiceModel yy_modelWithDictionary:data];
            success(YES,code,message,invoiceModel);
        } else {
            
            success(NO,code,message,nil);
        }
    } failure:^(NSError *error) {
        
        failure(error);
    }];
}


@end
